import type { RouteRecordRaw } from 'vue-router'

export const routes: Readonly<RouteRecordRaw[]> = [
  {
    path: '/',
    name: '主页',
    component: () => import('@/views/HomeView.vue'),
  },
  {
    path: '/user/login',
    name: '用户登录',
    component: () => import('@/views/user/UserLoginView.vue'),
    meta: {
      hidden: true,
    },
  },
  {
    path: '/user/register',
    name: '用户注册',
    component: () => import('@/views/user/UserRegisterView.vue'),
    meta: {
      hidden: true,
    },
  },
  {
    path: '/admin/user-manage',
    name: '用户管理',
    component: () => import('@/views/user/UserManageView.vue'),
    meta: {
      access: 'admin',
    },
  },
  {
    path: '/admin/product-manage',
    name: '商品管理',
    component: () => import('@/views/product/ProductManageView.vue'),
    meta: {
      access: 'admin',
    },
  },
  {
    path: '/product/detail/:id',
    name: '商品详情',
    component: () => import('@/views/product/ProductDetailView.vue'),
    props: true,
    meta: {
      hidden: true,
    },
  },
  {
    path: '/product/batch-add',
    component: () => import('@/views/product/ProductBatchAddView.vue'),
    meta: {
      access: 'admin',
    },
  },
  {
    path: '/cart/my',
    name: '我的购物车',
    component: () => import('@/views/cart/CartManageView.vue'),
  },
  {
    path: '/user/center',
    name: '个人中心',
    component: () => import('@/views/user/UserCenterView.vue'),
    meta: {
      hidden: true,
    },
  },
]
